if (!jsx3.lang.Class.forName("ux.megatron.example.tour.dialog.TestDialogPage")) {

jsx3.Class.defineClass(
    "ux.megatron.example.tour.dialog.TestDialogPage",
    jsx3.gui.Block,
    null,
    function (objRoot) {


var testAlertDialog = function() {
    //
    ux.megatron.Dialog.alert("测试对话框", "你好吗？", null, "知道", {width:500, height:200});
};

var testConfirmDialog = function() {
    //
    ux.megatron.Dialog.confirm("测试对话框", "你现在还好吗？", null, null, "很好", "不好");
};

var testPromptDialog = function() {
    ux.megatron.Dialog.prompt("测试对话框", "你需要填些什么");
};


var testErrorDialog = function() {
    ux.megatron.Dialog.showErrorDialog("testErrorCache", "errorID", "shortMessage", "longMessage", "问题", "详细说明", "弹出错误提示");
};


            var showSource = function(txtSource, value) {
                txtSource.setValue(value, true);
            }

            objRoot.prototype.onAfterDeserialize = function() {
                this.txtSource = this.getDescendantOfName("txtSource");
                this.btnAlert    = this.getDescendantOfName("btnAlert");
                this.btnConfirm  = this.getDescendantOfName("btnConfirm");
                this.btnPrompt   = this.getDescendantOfName("btnPrompt");
                this.btnErrorDlg = this.getDescendantOfName("btnErrorDlg");

                this.btnAlert.clickHandler    = this.genHandler(testAlertDialog, this.txtSource);
                this.btnConfirm.clickHandler  = this.genHandler(testConfirmDialog, this.txtSource);
                this.btnPrompt.clickHandler   = this.genHandler(testPromptDialog, this.txtSource);
                this.btnErrorDlg.clickHandler = this.genHandler(testErrorDialog, this.txtSource);

                var errorCache = jsx3.xml.CDF.Document.newDocument();
                errorCache.insertRecord({
                            "jsxid" : "errorID",
                            "shortMessage" : "这是一个测试的错误",
                            "longMessage"  : "这个错误的原因很难说的清楚。这个错误的原因很难说的清楚。这个错误的原因很难说的清楚。这个错误的原因很难说的清楚。"
                    }, "jsxroot");
                ux.megatron.Main.getServer().getCache().setDocument("testErrorCache", errorCache);
            }

            objRoot.prototype.genHandler = function(fctn, source) {
                return function() {
                    fctn();
                    showSource(source, fctn.toString());
                }
            }
    });

};